import { defineStore } from 'pinia';
import {ref} from 'vue'

export const useMemberStore = defineStore(
    'main',
    () => {
		interface Obj {
			value:string
			phone:string
		}
        
		const arr = ref<Array<Obj>>([])
		const setArr = (value:Obj)=>{
			arr.value.push(value)
		}
		const deleteArr = ()=>{
			arr.value = []
		}
		const changeArr = (value:Array<Obj>)=>{
			arr.value = value
		}
        return { arr,setArr,deleteArr,changeArr}
    
    },
    {
        // 配置持久化
        persist: {
            storage: {
                setItem(key, value) {
                    uni.setStorageSync(key, value)
                },
                getItem(key) {
                    return uni.getStorageSync(key)
                },
            },
        },
    },
)